package com.www.applyword.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.www.applyword.R;

import java.util.List;

public class GirdDropDownAdpter extends BaseAdapter {
    private Context context;
    private List<String> beanList;
    private LayoutInflater inflater;


    public GirdDropDownAdpter(Context context, List<String> beanList) {
        this.context = context;
        this.beanList = beanList;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return beanList.size();
    }

    @Override
    public Object getItem(int position) {
        return beanList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = inflater.inflate(R.layout.item_city,null);
            holder.bt = convertView.findViewById(R.id.item_city_name_tv);
          //  holder.iv_type2 = (RoundImageView)convertView.findViewById(com.dai.zhenfujin.R.id.iv_type2);
            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.bt.setText(beanList.get(position));

        return convertView;
    }

    class ViewHolder {
        private TextView bt;
    }
}
